<template>
	<view>
		<u-loading-page loading-mode="semicircle" :loading="loading" color='#57E3A8' loading-text="请稍等" ></u-loading-page>
		<view v-show="!loading">
			<Address></Address>
			<view class="list_order" v-for="item,index in orderData" :key='index'>
				<view class="list_order_img">
					<image :src="item.goods.cover_url" style="width: 80%;height: 80%;border-radius: 20rpx;"></image>
				</view>
				<view class="list_order_context">
					<view class="goods_titel">
						{{item.goods.title}}
					</view>
					<view class="careat_time" >
						创建时间:{{item.created_at}}
					</view>
					<view class="goods_pirce">
						数量{{item.num}} × <text style="color: #763500;">单价{{item.goods.price}}￥</text>
					</view>
					<view class="sum_pirce">
						总价:{{item.num * item.goods.price}}￥
					</view>
				</view>
			</view>
		</view>
		<PayButton></PayButton>
	</view>
</template>

<script>
	import PayButton from '../../components/PayButton/PayButton.vue'
	import {mapState,mapActions} from 'vuex'
	import Address from '../../components/Address/Address.vue'
	export default {
		data() {
			return {
				loading:true,
				
			};
		},
		components: {
			Address,PayButton
		},
		methods: {
			...mapActions('indexStore', ['getOrdersData']),
		},
		async onLoad() {
			const result = await this.getOrdersData()
			if(result){
				this.loading = false
			}
		},
		computed: {
			...mapState('indexStore',['orderData','addressDate']),
		},
	}
</script>

<style lang="scss">
page{
		background-color: #F9F871 !important;
		// #ifdef H5
		padding-bottom: 80rpx;
		// #endif
		
	}
.address{
	width: 100%;
	height: 150rpx;
	background-color: #57E3A8;
}
.list_order{
	width: 95%;
	height: 200rpx;
	margin: 20rpx auto;
	background-color: #57E3A8;
	border-radius: 30rpx;
	display: flex;
	overflow: hidden;
	.list_order_img{
		width: 30%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.list_order_context{
		width: 70%;
		height: 100%;
		padding: 20rpx 0;
		.careat_time{
			font-size: 25rpx;
			font-weight: 700;
		}
		.goods_titel{
			font-weight: 700;
			font-size: 35rpx;
		}
		.goods_pirce{
			text-align: right;
			font-size: 24rpx;
			color: #364954;
			padding-right: 20rpx;
			font-weight: 600;
		}
		.sum_pirce{
			text-align: right;
			padding-right: 20rpx;
			margin-top: 10rpx;
			color: #763500;
			font-weight: 700;
		}
	}
}
</style>
